﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Data;
using University.Workshop.Business;
using University.Workshop.Model;
using System.Collections.ObjectModel;

namespace University.Workshop.Tests
{
    [TestClass()]
    public class ProductControllerTest
    {

        private TestContext testContextInstance;
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        
        [TestMethod()]
        public void RegisterTest()
        {
            Random ran = new Random();
            int num = ran.Next(10000);
            Product product = new Product()
            {
                CodeProduct = num.ToString(System.Globalization.CultureInfo.CurrentCulture),
                NameProduct = "Resfrianex",
                Presentation = "Tableta",
                CodeProvider = "prov111",             
                DateAdmission = DateTime.Now,               
                State = "A"
            }; 
            bool expected = true; 
            bool actual;
            actual = ProductController.Register(product);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ValidateCodeTest()
        {
            string code = "med001"; 
            bool expected = false; 
            bool actual;
            actual = ProductController.ValidateCode(code);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void EditProductTest()
        {
            Product product = new Product()
            {
                CodeProduct = "med001",
                NameProduct = "Resfrianex",
                Presentation = "Tableta",
                CodeProvider = "prov111",
                DateAdmission = DateTime.Now,
                State = "A"
            };
            bool expected = true; 
            bool actual;
            actual = ProductController.EditProduct(product);
            Assert.AreEqual(expected, actual);
           
        }

        [TestMethod()]
        public void DeleteProductOkTest()
        {
            string value = "med001";
            bool expected = true; 
            bool actual;
            actual = ProductController.DeleteProduct(value);
            Assert.AreEqual(expected, actual);
            
        }
   
        [TestMethod()]
        public void HabilityProductTest()
        {
            string value = "med001"; 
            bool expected = true; 
            bool actual;
            actual = ProductController.EnableProduct(value);
            Assert.AreEqual(expected, actual);
            
        }

        [TestMethod()]
        public void LookProductTest()
        {
            string value = "med001"; 
            DataTable expected = new DataTable() { Locale = System.Globalization.CultureInfo.CurrentCulture };
            DataTable actual;
            actual = ProductController.LookProduct(value);
            Assert.AreNotEqual(expected, actual);    
                    
        }

        
        [TestMethod()]
        public void GenerateQueryGetQuantityTest()
        {
            Collection<string> expected = null; 
            Collection<string> actual;
            actual = ProductController.GenerateQueryGetQuantity();
            Assert.AreNotEqual(expected, actual);
            
        }

        [TestMethod()]
        public void GenerateQuery1GetNameTest()
        {
            Collection<string> expected = null; 
            Collection<string> actual;
            actual = ProductController.GenerateQuery1GetName();
            Assert.AreNotEqual(expected, actual);
           
        }
    }
}
